package com.jsnj33.pdaproject.base;

import android.app.Application;
import android.content.Context;

import com.android.volley.RequestQueue;
import com.android.volley.toolbox.Volley;
import com.jsnj33.pdaproject.utils.CrashHandler;

import org.xutils.BuildConfig;
import org.xutils.x;

/**
 * 作者：LGP on 2017/12/28 17:12
 * 邮箱：1712115388@qq.com
 */
public class BaseApp extends Application {

    private static RequestQueue queues;
    private Context baseContext;
    private static BaseApp instance;

    @Override
    public void onCreate() {
        super.onCreate();
        baseContext = this;
        queues = Volley.newRequestQueue(getApplicationContext());
        x.Ext.init(this);
        x.Ext.setDebug(BuildConfig.DEBUG); // 是否输出debug日志, 开启debug会影响性能.
//        saveCrashLog();
    }

    private void saveCrashLog() {
        CrashHandler crashHandler = CrashHandler.getInstance();
        crashHandler.init(getApplicationContext());
    }

    @Override
    public Context getBaseContext() {
        return baseContext;
    }

    public static BaseApp getInstance() {
        return instance;
    }

    public static RequestQueue getHttpQueues() {
        return queues;
    }


}
